import { http } from "@/utils/http";
import { baseUrlApi } from "../utils";

/** 获取基础档案-全部单位列表 */
export const getUnitPage = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/unit/page"), { params });
};

/** 获取基础档案-计量单位名称列表 */
export const getUnitemPage = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/unit/item/page"), {
    params
  });
};

/** 基础档案--全部单位列表-新增 */
export const unitAdd = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/unit/add"), { data });
};

/** 基础档案--计量单位名称列表-新增 */
export const unitItemAdd = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/unit/item/add"), { data });
};

/** 基础档案--全部单位列表-编辑 */
export const unitUpdate = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/unit/update"), {
    data
  });
};

/** 基础档案-计量单位名称列表-编辑 */
export const unitItemUpdate = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/unit/item/update"), { data });
};

/** 基础档案-全部单位列表-删除 */
export const unitDelete = (id?: any) => {
  return http.request<any>("post", baseUrlApi(`/unit/delete?id=${id}`));
};

/** 基础档案-计量单位名称列表-删除 */
export const unitItemDelete = (id?: any) => {
  return http.request<any>("post", baseUrlApi(`/unit/item/delete?id=${id}`));
};
